package crimgur;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.http.*;

import entity.ImageItem;
import util.ItemHelper;
import util.UserHelper;

@SuppressWarnings("serial")
public class CrimgurServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    	int numBatch = Integer.parseInt(req.getParameter("num"));
    	if (numBatch <= 0)
    		numBatch = 1;
        resp.setContentType("text/html");
        PrintWriter out = resp.getWriter();
        out.println("BATCH IMAGE LOADER");
       
        ItemHelper.loadStatic(numBatch);




/*        List<entity.User> userLadder = UserHelper.getLadder(0, 3);
        for (entity.User user : userLadder) {
        	out.println(user);
        }
        
        System.out.println("Getting randomItem");
        ImageItem anItem = ItemHelper.getRandomItems(300, "human", null).get(0);
        System.out.println("Getting randomItem exluding:"+anItem.getUrl());
        List<ImageItem> itemList = ItemHelper.getRandomItems(500, "human", anItem);
        for (ImageItem item : itemList) {
        	out.println(item);
        	out.println("<td><img src=\""+item.getUrl()+"\"/>");
        }
*/	}
}